-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix #10977] Add option to raise cop errors, --raise-cop-error
#11001
Conversation
--raise-cop-error
df0693b
to
ca89e57
Compare
--raise-cop-error
--raise-cop-error
48b8859
to
5111380
Compare
I'm not sure I understand the use case for this? Why do you want rubocop to stop when an error is raised? (Which shouldn't happen in normal operation, of course) Also there's already |
Hi @dvandersluis, thanks for taking a look at this!! We need this option to rescue any cop exceptions when running RuboCop on the Ruby LSP for a better use experience. The TL;DR is that we want to make sure users know there is an error (instead of failing silently using We have a more detailed issue you can find here: Shopify/ruby-lsp#250 |
I see. That makes sense to me, but it has to be documented very clearly. |
@wildmaples Ping :-) |
There was no option to get granular cop-related error. Previously, we only had :raise_error, which is used to test exceptions internally. This change adds a user-facing option to raise cop-related errors, while maintaining the internal :raise_error option.
5111380
to
b165c59
Compare
Looks good. I'll include merge this after cutting the next bugfix release. |
Fix #10977
We want to be able to rescue cop-related errors.
There exists
:raise_error
, but it's used for internal tests such as through cop helper.I added a new option that raises with
RuboCop::ErrorWithAnalyzedFileLocation
, which surfaces more information.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.